Fixes incorrect host for accessory logs follow with specified host#1615
Fixes incorrect host for accessory logs follow with specified host#1615matthewbjones wants to merge 1 commit intobasecamp:mainfrom
Conversation
|
Hmm interesting. I think that if |
|
My understanding is that although the CLI correctly filters |
|
I think the reason why this isn't a more universal problem is that the CLI does correctly filter hosts, but for most Kamal commands the CLI part of the codebase is the one that does the execution/SSH, but when it comes to Accessory, the CLI no longer runs the SSH commands and leaves it to the Accessory command to do it itself, and when the CLI makes the Accessory it does not provide the filtered hosts, so the Accessory always delegates to configured hosts. I've poked around a bit at it again and I don't really see a path that doesn't involve changing the CLI to somehow specify the host(s), either by passing it into an Accessory's method like It looks like def app(role: nil, host: nil)
Kamal::Commands::App.new(config, role: role, host: host)
end
def accessory(name)
Kamal::Commands::Accessory.new(config, name: name)
endIf this were to be improved to something like: def app(role: nil, host: nil)
Kamal::Commands::App.new(config, role: role, host: host)
end
def accessory(name, hosts: nil)
Kamal::Commands::Accessory.new(config, name: name, hosts: hosts)
endThen the If you would like, I can update the PR to go more in this direction and try to align |
|
@djmb Just wanted to give a polite nudge to see what your latest thoughts are. I'm more than willing to revise the PR to reflect my recent comment about updating the |
|
I need to do some work on filtering the hosts/accessory hosts correctly so that this isn't necessary |
|
Okay great thanks. If I can be helpful at all just let me know. |
Bug
Prior to this fix, if you ran the command:
kamal accessory logs my-accessory -h server2.hostname.com -fIt would output:
Notice it says it will follow logs on
["server2.hostname.com"]but thesshcommand is using the incorrect hostssh -t root@server.hostname.com.Solution
Now if you run the same command, it will now use the correct host: